#include<bits/stdc++.h>
#define int long long
#define For(i,a,b) for(int i=a;i<=b;++i)
#define Rof(i,a,b) for(int i=a;i>=b;--i)
#define rep(i,a) for(int i=1;i<=a;++i)
#define print(x) printf("%lld\n",(int)x)
#define prn(x) printf("%lld ",(int)x)
using namespace std;
const int N=2e6+5,Mod=998244353;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){f=(ch=='-'?-f:f);ch=getchar();}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return x*f;
}
int sum=0;
int n;
double f[N],t[N],b[N];
int tot,cnt;
bool isp[N];
map<pair<int,int>,int>mp;
struct Query{
	int op,f,t,b;
	int sp;
}z[N],s[N],sb[N],A[N];
inline bool cmp(Query x,Query y){
	return (x.f*x.t+x.b)*y.t<(y.f*y.t+y.b)*x.t;
}
struct TREE{
int tr[N];
inline int lowbit(int x){return x&(-x);}
inline void add(int x,int k){while(x<=cnt){tr[x]+=k;x+=lowbit(x);}}
inline int qry(int x){int res=0;while(x){res+=tr[x];x-=lowbit(x);}return res;}
}tr1,tr2,tr3;
int answer[N];
bool vis[N];
//~ int tr[N<<4],add[N<<4];
//~ #define ls(x) (x<<1)
//~ #define rs(x) (x<<1|1)
//~ inline int pushup(int x){maxx=max(maxx,)}
//~ inline void down(int x,int k){
	//~ tr[x]+=k;
	//~ add[x]+=k;
//~ }
//~ inline int pushdown(int x){
	//~ down(ls(x),add[x]);
	//~ down(rs(x),add[x]);
	//~ add[x]=0;
//~ }
//~ void updata(int x,int l,int r,int L,int R,int k){
	//~ if(L<=l&&r<=R){
		//~ down(x,k);
		//~ return ;
	//~ }
	//~ pushdown(x);
	//~ int mid=(l+r)>>1;
	//~ if(L<=mid) updata(ls(x),l,mid,L,R,k);
	//~ if(R>mid) updata(rs(x),mid+1,r,L,R,k);
//~ }
//~ int query(int x,int l,int r,int k){
	//~ if(l==r) return tr[x];
	//~ pushdown(x);
	//~ int mid=(l+r)>>1;
	//~ if(k<=mid) return query(ls(x),l,mid,k);
	//~ else return query(rs(x),mid+1,r,k);
//~ }
inline void solve(){
	int Q=read();
	//（f*t+b）/t
	For(i,1,Q){
		int op=z[i].op=read();
		if(op==1){
			tot++;
			s[tot].f=sb[tot].f=z[i].f=read();
			s[tot].t=sb[tot].t=z[i].t=read();
			s[tot].b=sb[tot].b=z[i].b=read();
			//~ if(z[i].t==0) tot--;
		}
		else{
			int sp=z[i].sp=read();
		}
	}
	sort(s+1,s+tot+1,cmp);
	For(i,1,tot){
		//~ if(s[i].t==0) continue;
		if(i==1||(s[i].f*s[i].t+s[i].b)*s[i-1].t!=(s[i-1].f*s[i-1].t+s[i-1].b)*s[i].t){
			A[++cnt]=s[i];
			int x=__gcd(s[i].f*s[i].t+s[i].b,s[i].t);
			mp[{(s[i].f*s[i].t+s[i].b)/x,s[i].t/x}]=cnt;
		}
	}
	int sum=0,sum1=0,sum2=0;int B=0;
	//~ cout<<A[2813].f<<" "<<A[2813].t<<" "<<A[2813].b<<endl;
	int ppp=0;
	int k=0,aps=0;
	For(i,1,Q){
		int op=z[i].op;
		if(op==1){
			int f=z[i].f,t=z[i].t,b=z[i].b;
			vis[++ppp]=1;
			//~ cout<<"add:"<<ppp<<" ";
			For(j,1,tot){
				//~ cout<<f<<" "<<t<<" "<<b<<endl;
				//~ cout<<sb[j].f<<" "<<sb[j].t<<" "<<sb[j].b<<endl;
				//~ cout<<fabs(1.0*t*(f-1.0*(sb[j].f*sb[j].t+sb[j].b)/sb[j].t)+1.0*b)<<" ";
				answer[j]+=abs(t*(f*sb[j].t)+b*sb[j].t-(sb[j].f*sb[j].t+sb[j].b)*t);
			}
			//~ puts("");
			//~ if(t==0)aps+=z[i].b;
			//~ int x=__gcd(f*t+b,t);
			//~ int pp=mp[{(f*t+b)/x,t/x}];
			//~ cout<<pp<<" ";
			//~ tr1.add(pp,t+B);sum+=t+B;
			//~ tr3.add(pp,1);sum1+=1;
			//~ tr2.add(pp,(f*t+b));sum2+=(f*t+b);
		}
		else{
			int sp=z[i].sp;
			vis[sp]=0;
			int f=sb[sp].f,t=sb[sp].t,b=sb[sp].b;
			//~ cout<<"del:"<<sp<<" ";
			For(j,1,tot){
				answer[j]-=abs(t*(f*sb[j].t)+b*sb[j].t-(sb[j].f*sb[j].t+sb[j].b)*t);
			}
			//~ if(t==0)aps+=b;
			//~ int x=__gcd(f*t+b,t);
			//~ int pp=mp[{(f*t+b)/x,t/x}];
			//~ tr1.add(pp,-t-B);sum-=(t+B);
			//~ tr3.add(pp,-1);sum1-=1;
			//~ tr2.add(pp,-(f*t+b));sum2-=(f*t+b);
		}
		double ans=1000000000000000000.0;
		For(j,1,tot) if(sb[j].t&&vis[j]){ans=min(ans,1.0*answer[j]/abs(sb[j].t));}//puts("");
		//~ For(res,1,cnt){
			//~ int ll=tr1.qry(res-1),rr=sum-tr1.qry(res);
			//~ int lll=tr3.qry(res-1),rrr=sum1-tr3.qry(res);
			//~ ll-=lll*B;rr-=rrr*B;
			//~ int L=tr2.qry(res-1),R=sum2-tr2.qry(res);
			//~ if(ll!=tr1.qry(res))ans=min(ans,fabs(1.0*(A[res].f*A[res].t+A[res].b)*ll/A[res].t-1.0*L)+fabs(1.0*R-1.0*(A[res].f*A[res].t+A[res].b)*rr/A[res].t)+aps);
		//~ }
		//~ int l=1,r=cnt,res=0;
		//~ while(l<=r){
			//~ int mid=(l+r)>>1;int tt=tr1.qry(mid);
			//~ if(tt<sum-tt){
				//~ l=mid+1;
			//~ }
			//~ else r=mid-1,res=mid;
		//~ }
		//~ int ll=tr1.qry(res-1),rr=sum-tr1.qry(res);
		//~ int lll=tr3.qry(res-1),rrr=sum1-tr3.qry(res);
		//~ ll-=lll*B;rr-=rrr*B;
		//~ int L=tr2.qry(res-1),R=sum2-tr2.qry(res);
		//cout<<ll<<" "<<rr<<endl;
		//~ printf("%.10lf\n",1.0*(A[res].f*A[res].t+A[res].b)*ll/A[res].t-1.0*L+1.0*R-1.0*(A[res].f*A[res].t+A[res].b)*rr/A[res].t+aps);
		printf("%.10lf\n",ans);
	}
}
signed main(){
	freopen("love.in","r",stdin);
	freopen("love.out","w",stdout);
	int T=1;
	while(T--)solve();
	return 0;
}
//
